package com.vmj.natives.java.lang;

import com.vmj.heap.VMObject;
import com.vmj.natives.NativeMethod;
import com.vmj.natives.Registry;
import com.vmj.rtda.Frame;
import com.vmj.rtda.LocalVars;

import java.lang.String;

/**
 * Created by yangshoujun on 2017/9/24 下午6:06.
 */
public class ClassLoader {

    public static final java.lang.String jlClass = "java/lang/ClassLoader";

    public static void init() {

        Registry.register(jlClass, "findBuiltinLib", "(Ljava/lang/String;)Ljava/lang/String;", new NativeMethod() {
            public void execute(Frame frame) {
                LocalVars vars = frame.getLocalVars();
                VMObject paramObj = vars.getRef(0);
                String str = paramObj.getRefString();

                frame.getOperandStack().pushRef(paramObj);
            }
        });

        Registry.register("java/lang/ClassLoader$NativeLibrary", "load", "(Ljava/lang/String;Z)V", new NativeMethod() {
            public void execute(Frame frame) {
                LocalVars vars = frame.getLocalVars();
                VMObject paramObj = vars.getRef(1);
                String str = paramObj.getRefString();
                boolean bool = vars.getBoolean(2);
                java.lang.System.out.println();
            }
        });
    }
}
